<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<style>
fieldset {
    position: relative;
    padding-top: 30px;
    padding-left: 0px;
    padding-right: 0px;
    width: 200px;
    border: 1px solid green;
}
legend {
    background: green;
    left: 0;
    right: 0;
    top: 0;
    position: absolute;
    width: auto;
}
</style>
<body>
    <fieldset>
        <legend id="legend">Legend</legend>
        <div>Fieldset content</div>
    </fieldset>
</body>
<script>
description("This test checks the absolute postioned legend element to honor auto width.");
shouldBe('legend.offsetWidth', '200');
shouldBe('legend.clientWidth', '200');
</script>
</html>
